<template>
  <el-select v-model="Value" placeholder="请选择">
    <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
    </el-option>
  </el-select>
</template>
<style lang="scss">

</style>
<script>
export default {
   props: {
      value: {
         default: ""
      }, //下拉的value
      label: {
         default: ""
      }, //下拉的label
      options: {
         default: function() {
            return [];
         }
      }, //下来数据数组
      valuefield: {
         default: "value"
      }, //下拉的value字段
      labelfield: {
         default: "label"
      } //下拉的label字段
   },
   data() {
      return {};
   },
   created() {},
   computed: {
      Value: {
         get() {
            return this.value;
         },
         set(val) {
            var result = {};
            if (this.options)
               for (var i = 0; i < this.options.length; i++) {
                  if (this.options[i].value == val) {
                     result = this.options[i];
                     break;
                  }
               }
            // this.$emit("update:label", result.label);
            this.$emit("input", result.label);
         }
      }
   },
   methods: {}
};
</script>


